<?php


namespace app\uniapp\controller;

use app\common\exception\MiException;
use app\model\site\Site;
use app\model\site\User;
use app\uniapp\middleware\CheckLogin;
use app\uniapp\service\UniAuthService;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;

class UniController {

    /**
     * 登录中间件
     * 权限中间件
     * @var array
     */
    protected array $middleware = [
//        CheckLogin::class,
    ];

    protected string $appid;
    protected string $uniPlatform;

    /**
     * @throws MiException
     */
    public function __construct()
    {

        $uniPlatform = getUniPlatform();
        $appid = getAppid();
        $this->uniPlatform = $uniPlatform;
        $this->appid = $appid;
        $this->initialize();
    }


    protected function initialize()
    {

    }

    protected function param($key='',$default=''){
        $data = request()->param($key, $default);
        if (is_array($data)){
            unset($data['create_time']);
            unset($data['update_time']);
        }
        return $data;
    }

    protected function post($key='', $default=''){
        $data = request()->post($key, $default);
        if (is_array($data)){
            unset($data['create_time']);
            unset($data['update_time']);
        }
        return $data;
    }


}
